# $Id: PKGBUILD 81965 2013-01-05 03:15:58Z heftig $
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Mateusz Herych <heniekk@gmail.com>
# Contributor: Charles Lindsay <charles@chaoslizard.org>

pkgname=cdemu-client
pkgver=2.0.0
pkgrel=1
pkgdesc="Simple command-line client for controlling cdemu-daemon"
arch=(any)
url="http://cdemu.sourceforge.net/"
license=(GPL)
depends=(python2 dbus-python cdemu-daemon desktop-file-utils)
makedepends=(intltool cmake)
conflicts=('cdemu')
install=cdemu-client.install
source=("http://downloads.sourceforge.net/cdemu/$pkgname-$pkgver.tar.bz2")
md5sums=('ceeec43270c28ea02c7e8a5a7009f3e0')

build() {
  cd $pkgname-$pkgver

  # python2 fix
  sed -i '1s|^#!.*python$|&2|' src/cdemu

  # fix text domain
  # bash completion dir change
  sed -i CMakeLists.txt -e "/^project /s/cdemu/&-client/" -e "s|\
DESTINATION \${CMAKE_INSTALL_SYSCONFDIR}/bash_completion.d|\
DESTINATION \${CMAKE_INSTALL_DATADIR}/bash-completion/completions|"

  mkdir build; cd build
  cmake .. \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr
  make
}

package() {
  cd $pkgname-$pkgver/build
  make DESTDIR="$pkgdir" install
}
